/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 combat_label.h

	$Header: /heroes4/combat_label.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( COMBAT_LABEL_H_INCLUDED )
#define COMBAT_LABEL_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>
#include "abstract_combat_object.h"
#include "bitmap_group_ptr.h"
#include "font_cache.h"
#include "idle_processor.h"

class t_bitmap_layer;
class t_combat_creature;
enum  t_player_color;

// -----------------------------------------------------------------------
// label for creature stacks in combat
// -----------------------------------------------------------------------

class t_combat_label : public t_abstract_combat_object, public t_idle_processor
{
public:
	t_combat_label( t_battlefield& battlefield );
	t_combat_label( t_combat_creature& actor, t_player_color color, double scale );

	// Member functions
	virtual bool					blocks_movement() const;
	t_map_point_3d					compute_position( bool check_overlap = true ) const;
	virtual void					draw_shadow_to(
										t_uint32				current_time,
										t_screen_rect const &	source_rect,
										t_abstract_bitmap16 &	dest,
										t_screen_point const &	dest_point ) const;
	virtual void					draw_shadow_to(
										t_uint32				current_time,
										t_abstract_bitmap16 &	dest,
										t_screen_point const &	dest_point ) const;
	virtual void					draw_to(
										t_uint32				current_time,
										t_screen_rect const &	source_rect,
										t_abstract_bitmap16 &	dest,
										t_screen_point const &	dest_point ) const;
	virtual void					draw_to(
										t_uint32				current_time,
										t_abstract_bitmap16 &	dest,
										t_screen_point const &	dest_point ) const;
	virtual int						get_depth() const;
	virtual int						get_footprint_size() const;
	virtual int						get_height() const;
	virtual t_combat_object_type	get_object_type() const;
	virtual t_screen_rect			get_rect() const;
	virtual t_screen_rect			get_rect( t_uint32 current_time ) const;
	virtual t_screen_rect			get_shadow_rect() const;
	virtual t_screen_rect			get_shadow_rect( t_uint32 current_time ) const;
	virtual bool					hit_test( t_uint32				current_time,
											  t_screen_point const &	point ) const;
	virtual bool					is_animated() const;
	virtual bool					is_underlay() const;
	virtual void					on_idle();
	virtual void					on_placed();
	virtual void					on_removed();
	virtual void					place_during_read( t_battlefield& battlefield );
	virtual bool					read( t_combat_reader& reader );
	virtual bool					needs_redrawing( t_uint32	last_update_time,
													 t_uint32	current_time ) const;
	void							set_selected( bool arg );
	virtual bool					write( t_combat_writer& writer ) const;
private:
	void draw_status_bar( int value, int limit_value, t_bitmap_layer const* bar,
						  t_screen_rect const& client_source_rect,
						  t_abstract_bitmap16 &	dest,
						  t_screen_point const& dest_point ) const;
	void set_creature( t_combat_creature const* creature, t_player_color color, double scale );
	void set_frame( int frame );

	// Data members
	t_combat_creature const*	m_actor; 
	t_battlefield&				m_battlefield;
	t_bitmap_group_ptr			m_bitmaps;
	int							m_bitmap_number;
	t_uint16					m_color;
	int							m_frame;
	t_cached_font				m_font;
	std::vector<int>			m_frames[2];
	t_bitmap_group_ptr			m_health_bitmaps;
	t_bitmap_layer const*		m_health_background;
	t_bitmap_layer const*		m_health_bar;
	t_screen_point				m_health_origin;
	t_bitmap_layer const*		m_mana_bar;
	t_screen_point				m_origin;
	bool						m_selected;
	t_screen_rect				m_text_rect;
};								

inline void t_combat_label::set_selected( bool arg )
{
	m_selected = arg;
}

typedef t_counted_ptr<t_combat_label> t_combat_label_ptr;

#endif // !defined( COMBAT_LABEL_H_INCLUDED )
